import request from '@/utils/request';

// 获取分类列表
export function getCategoryList() {
  return request({
    url: '/api/api/categories/getList',
    method: 'get',
  });
}

// 获取分类详情
export function getCategoryDetail(id) {
  return request({
    url: `/api/api/categories/getCategoryDetail/${id}`,
    method: 'get',
  });
}

// 添加分类
export function saveCategory(data) {
  return request({
    url: '/api/api/categories/add',
    method: 'post',
    data,
  });
}

// 更新分类
export function updateCategory(id, data) {
  return request({
    url: `/api/api/categories/update/${id}`,
    method: 'put',
    data,
  });
}

// 删除分类
export function deleteCategory(id) {
  return request({
    url: `/api/api/categories/delete/${id}`,
    method: 'delete',
  });
}

// 更新分类状态
export function updateCategoryStatus(id, status) {
  return request({
    url: `/api/api/categories/status/${id}`,
    method: 'put',
    params: { status },
  });
}
